London | 26-ITP-January | Karla Grajales | Sprint 1 | coursework/sprint-1#910
London | 26-ITP-January | Karla Grajales | Sprint 1 | coursework/sprint-1#910Grajales-K wants to merge 23 commits intoCodeYourFuture:mainfrom
Conversation
…d using and alert.
… methods like substring and padStart to add and take part or the string
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
|
||
| const initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0); | ||
| console.log( `acronym = ${initials}`); | ||
|
|
There was a problem hiding this comment.
Nicely done. It might be better practice to stick with the variable declaration format already provided.
|
|
||
|
|
||
| console.log(`The dir is 👉 ${dir}`); | ||
| console.log(`The nameFile is 👉 ${fileName}`); |
There was a problem hiding this comment.
It's good practice to infuse an additional variable into your task. Well done.
| Math.floor() //removes decimal part and returns whole number | ||
| Math.random() //needs to values between minimum and maximum to generate a random number | ||
|
|
||
| console.log(maximum - minimum + 1 ) + minimum; // this is same as 100 - 1 + 1 = 100 | ||
| console.log(`The random number is ${num}`); No newline at end of file |
There was a problem hiding this comment.
You need to do more in following the given task instruction. Is there a way you could have broken down the flow of the code more? Rather than focusing on just highlighting the math object, why not expatiate on how the equation is solved to arrive at the value in the num variable.
| const numberString = cardNumber.toString(); | ||
| const last4Digits = numberString.slice(-4); | ||
| const num = Number(last4Digits); | ||
|
|
||
| console.log(num); |
There was a problem hiding this comment.
Very good implementation and variable naming convention.
| // There are 6 function calls in this file: | ||
| // Line 5: carPrice.replaceAll(",", "") | ||
| // Line 5: Number(carPrice.replaceAll(",", "")) | ||
| // Line 6: priceAfterOneYear.replaceAll(",", "") | ||
| // Line 6: Number(priceAfterOneYear.replaceAll(",", "")) | ||
| // Line 10: console.log(`The percentage change is ${percentageChange}`) this is also | ||
| // a function call to log the output as string to the console, then call the var percentageChange |
There was a problem hiding this comment.
Can you have a look at the number of function calls again and if you are sure, provide a little textual explanation for your reasoning.
| //result stores the variables of totalHours, remainingMinutes and remainingSeconds in a string format readable time clock "H:M:S" | ||
| //A better name for this variable could be MovieDuration |
There was a problem hiding this comment.
Great contextual naming convention
| 📢 The message you pass to alert() is displayed to the user. | ||
|
|
||
| ⏸️ JavaScript execution pauses until the user clicks OK. | ||
|
|
||
| 🚫 The user can’t interact with the page while the alert is open (it blocks the UI). | ||
|
|
||
|
|
| Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`. | ||
|
|
||
|
|
||
| let myName = prompt("hello what is your name") | ||
| alert("hi " + myName) | ||
|
|
||
| The prompt function displays a modal dialog that captures user input. The value entered is stored in myName, and alert then displays a greeting that includes that value. | ||
|
|
||
|
|
||
| What effect does calling the `prompt` function have? | ||
| What is the return value of `prompt`? | ||
|
|
||
| Calling the prompt() function displays a modal pop-up dialog that: | ||
|
|
||
| * Shows a message to the user | ||
|
|
||
| * Includes a text input field | ||
|
|
||
| * Has OK and Cancel buttons | ||
|
|
||
| * Blocks interaction with the page until the user responds | ||
|
|
There was a problem hiding this comment.
Are there ways to improve your implementation to follow the acceptance criteria for the tasks? Read through it and practise again. I'm sure you will get new insights
|
|
||
| // Create a variable called wholeNumberPart and assign to it an expression that evaluates to 56 ( the whole number part of num ) | ||
| // Create a variable called decimalPart and assign to it an expression that evaluates to 0.5678 ( the decimal part of num ) | ||
| // Create a variable called roundedNum and assign to it an expression that evaluates to 57 ( num rounded to the nearest whole number ) | ||
|
|
||
| // Log your variables to the console to check your answers | ||
|
|
||
|
|
||
| const wholeNumberPart = Math.floor(num); | ||
| console.log(` Whole number = ${wholeNumberPart}`); | ||
|
|
||
| const decimalPart = num - wholeNumberPart; | ||
| console.log(` Decimal part = ${decimalPart.toFixed(4)}`); // toFixed(4) to show 4 decimal places instead of whole number | ||
|
|
||
| console.log(`type of parameter = ${typeof(wholeNumberPart)}`); //confirm that decimalPart is a number | ||
|
|
||
| const roundedNum = Math.round(num); // rounds to nearest whole number | ||
| console.log(` Rounded number = ${roundedNum}`); No newline at end of file |
There was a problem hiding this comment.
It's good practice to involve some new tasks for yourself to improve your skills.
Theoreoluwa
left a comment
There was a problem hiding this comment.
Very well done so far. Kindly see to the comments made and how to make it better.
Learners, PR Template
Self checklist
Changelist
This project is about starting to learn how to use methods in JS, and using the console on the browser, at some point, my branch remotely and locally lost the connection, so I ran from my terminal
git branch --unset-upstreamand thengit push -u origin coursework/sprint-1to link the branches.Questions
Do you have any recommendations for learning how to use Git more deeply, especially when we want to go back in history and keep only a specific part in the head of my branch?
Basically, a surgery choosing a specific part to bring back from historical commits.